package com.timoon.app.utils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
import org.apache.wicket.request.cycle.RequestCycle;


/**
 *<p></p>
 *<p></p>
 *<p>Copyright:Copyright(c)2013.4.1</p>
 *<p>Company:timoon</p>
 *@author 付乐天
 *@version 1.0 */
public class HttpServletUtil {

	public static HttpSession getHttpSession(){
	
		return ((ServletWebRequest) 
				RequestCycle.get().getRequest()).getContainerRequest().getSession();
	}
	public static HttpServletRequest getHttpRequest(){
		return ((ServletWebRequest) 
				RequestCycle.get().getRequest()).getContainerRequest();
	}
	public static String getBasePath(){
		
		HttpServletRequest request=HttpServletUtil.getHttpRequest();
		String url = request.getContextPath(); 
		String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+url; 
		return basePath;
	}
}
